import {UploadFile} from '../api/api'

export function Upload (file, type) {
  return new Promise((resolve, reject) => {
    let formData = new FormData(0)
    formData.append('file', file)
    formData.append('pathName', type)
    UploadFile(formData).then(data => {
      resolve(`${data.file.path.substring(7)}`)
    }).catch(() => {
      console.log('发送图片出现错误')
    })
  })
}
